﻿@model SuperiorModel.Api_ProductDetailModel
@{
    ViewBag.Title = ViewBag.Title;
    Layout = "~/Views/Shared/_Layout.cshtml";
    var spid = Request["spid"];
    var said = Request["said"];
    var commentCount = ViewBag.CommentCount;
}
<style>
    .weui-navbar + .weui-tab__bd.proinfo-tab-con {
        padding-top: 0px;
    }
</style>
<input type="hidden" value="@ViewHelper.ConvertJson(Model)" id="hidden_pModel" />
<div class="weui-content" style="padding-top: 3px;">
    <!--产品详情-->
    <div class="weui-tab">
        @*<div class="weui-navbar" style="position:fixed; top:0; left:0; right:0; height:44px;">
                <a class="weui-navbar__item proinfo-tab-tit weui-bar__item--on" href="#tab1">商品</a>
                <a class="weui-navbar__item proinfo-tab-tit" href="#tab2">详情</a>

            </div>*@
        <div class="weui-tab__bd proinfo-tab-con">
            <div id="tab1" class="weui-tab__bd-item weui-tab__bd-item--active">
                <!--主图轮播-->
                <div class="swiper-container-detail swiper-zhutu">
                    <div class="swiper-wrapper">
                        @foreach (var item in Model.BannerImgs)
                        {
                            <div class="swiper-slide"><img src="@item" /></div>
                        }

                    </div>
                    <div class="swiper-pagination swiper-zhutu-pagination"></div>
                </div>
                <div class="wy-media-box-nomg weui-media-box_text">
                    <h4 class="wy-media-box__title">@Model.Brand @Model.ProductName</h4>
                    @if (Model.MinAmount == Model.MaxAmount)
                    {
                        <div class="wy-pro-pri mg-tb-5">¥<em class="num font-20">@Model.MinAmount</em></div>
                    }
                    else
                    {
                        <div class="wy-pro-pri mg-tb-5">¥<em class="num font-20">@Model.MinAmount-@Model.MaxAmount</em></div>
                    }
                    

                    <p class="weui-media-box__desc">@Model.Title</p>
                    <p class="weui-media-box__desc">运费：@Model.ShipAmount</p>
                    @if (commentCount == 0)
                    {
                        <p class="weui-media-box__desc">暂无评价</p>
                    }
                    else
                    {
                        <a class="weui-media-box__desc" href="/Comment/List?id=@(Model.Id)&spid=@spid&said=@said">查看全部<span style="color:red">@commentCount</span>条评价</a>
                    }

                </div>

                <div class="wy-media-box2 weui-media-box_text">

                    <dl class="feedback-wrapper">
                        <dd>
                            <a class="react open-popup" data-target="#selcet_sku" href="javascript:;">
                                <div class="more1 more-weak comment-headline">
                                    <span class="sgui" id="choseStr">

                                        @if (Model.CurrentSkuType == 1)
                                        {
                                            @Html.Raw("选择:" + Model.ProductName + ",1" + Model.Unit)
                                        }
                                        else if (Model.CurrentSkuType == 2)
                                        {
                                            var _choseStr = "";
                                            for (int i = 0; i < Model.SkuManagerModel.Product_Sall_PropetyModelList.Count; i++)
                                            {
                                                if (i == Model.SkuManagerModel.Product_Sall_PropetyModelList.Count - 1)
                                                {
                                                    _choseStr += Model.SkuManagerModel.Product_Sall_PropetyModelList[i].Product_Sall_Propety_ValueList[0].PropetyValue + ",";
                                                }
                                                else
                                                {
                                                    _choseStr += Model.SkuManagerModel.Product_Sall_PropetyModelList[i].Product_Sall_Propety_ValueList[0].PropetyValue + "+";
                                                }
                                            }
                                            @Html.Raw("选择:" + _choseStr + "1" + Model.Unit)
                                        }
                                    </span>

                                </div>
                            </a>
                        </dd>

                    </dl>
                </div>
                <div class="wy-media-box2 weui-media-box_text">

                    <div class="merchant meui-zi">
                        <div class="zi_left">
                            <a href="javascript:;" class="weui_btn weui_btn_mini weui_btn_plain_primary ">@UserContext.User.ShopName</a>
                        </div>
                        <div class="zi_right">
                            <a href="/Home/Index?spid=@spid&said=@said" class="weui_btn weui_btn_mini weui_btn_plain_primary "><i class="f30"></i>进店逛逛</a>
                        </div>
                    </div>

                </div>
                <div class="pro-detail">
                    @Html.Raw(Model.Detail)
                </div>
            </div>


        </div>
    </div>
</div>
<span id="tophovertree" title="返回顶部"></span>
<!--底部导航-->
<div class="foot-black"></div>
<div class="weui-tabbar wy-foot-menu">
    <a href="/Home/Index?spid=@spid&said=@said" id='show-toast' class="promotion-foot-menu-items">
        <div class="weui-tabbar__icon promotion-foot-menu-collection"></div>
        <p class="weui-tabbar__label">首页</p>
    </a>
    <a href="/Cart/Index?spid=@spid&said=@said" class="promotion-foot-menu-items">
        <span class="weui-badge" style="position: absolute;top: -.4em;right: 1em;" id="cartNum">@ViewBag.CartCount</span>
        <div class="weui-tabbar__icon promotion-foot-menu-cart"></div>
        <p class="weui-tabbar__label">购物车</p>
    </a>
    <a href="javascript:;" class="weui-tabbar__item yellow-color open-popup" data-target="#selcet_sku">
        <p class="promotion-foot-menu-label"><span class="icon"></span>加入购物车</p>
    </a>
    <a href="javascript:;" class="weui-tabbar__item red-color open-popup" data-target="#selcet_sku">
        <p class="promotion-foot-menu-label"><span class="icon"></span>立即购买</p>
    </a>
</div>

<div id="selcet_sku" class='weui-popup__container popup-bottom' style="z-index:600;">
    <div class="weui-popup__overlay" style="opacity:1;"></div>
    <div class="weui-popup__modal">
        <div class="toolbar">
            <div class="toolbar-inner">
                <a href="javascript:;" class="picker-button close-popup">关闭</a>
                <h1 class="title">商品属性</h1>
            </div>
        </div>
        <div class="ware-brief-within-popover">
            <div class="preview"><img src="@Model.BannerImgs[0]"></div>
            <div class="info">
                <div class="pro_info_propety_productName">@Model.ProductName</div>
                @if (Model.CurrentSkuType == 1)
                {
                    <div class="price">
                        <span class="rmb">¥</span>
                        <span class="price-num" id="propety_price">
                            @Model.SkuManagerModel.SingleSkuModel.SallPrice 
                        </span>
                    </div>
                    <div class="selected" id="propety_stockNum">库存 @Model.SkuManagerModel.SingleSkuModel.StockNum @Model.Unit</div>
                }
                else
                {
                    var skumodel = ViewHelper.GetCurrentMoreSkuModel(Model.SkuManagerModel);
                    <div class="price">
                        <span class="rmb">¥</span>
                        <span class="price-num" id="propety_price">
                            @skumodel.SallPrice<label class="fen"></label>
                        </span>
                    </div>
                    <div class="selected" id="propety_stockNum">库存 @skumodel.StockNum 件</div>
                }

            </div>


        </div>
        <div class="modal-content">
            <div class="weui-msg" style="padding-top:0;">
                <div class="wy-media-box2 weui-media-box_text" style="margin:0;">
                    @if (Model.CurrentSkuType == 1)
                    {
                        <div class="weui-media-box_appmsg">
                            <div class="weui-media-box__hd proinfo-txt-l"><span class="promotion-label-tit">规格</span></div>
                            <div class="weui-media-box__bd">
                                <div class="promotion-sku clear">
                                    <ul>
                                        <li class="active"><a href="javascript:;">@Model.ProductName</a></li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                    }
                    else
                    {

                        foreach (var item in Model.SkuManagerModel.Product_Sall_PropetyModelList)
                        {
                            <div class="weui-media-box_appmsg">
                                <div class="weui-media-box__hd proinfo-txt-l"><span class="promotion-label-tit">@item.PropetyName</span></div>
                                <div class="weui-media-box__bd">
                                    <div class="promotion-sku clear">
                                        <ul>
                                            @for (int i = 0; i < item.Product_Sall_Propety_ValueList.Count; i++)
                                            {
                                                var pro = item.Product_Sall_Propety_ValueList[i];
                                                if (i == 0)
                                                {
                                                    <li class="active"><a href="javascript:;" class="attr_propety" propetyValueId="@pro.Id" propertyId="@item.Id">@pro.PropetyValue</a></li>
                                                }
                                                else
                                                {
                                                    <li><a href="javascript:;" class="attr_propety" propetyValueId="@pro.Id" propertyId="@item.Id">@pro.PropetyValue</a></li>
                                                }
                                            }
                                        </ul>
                                    </div>
                                </div>
                            </div>

                        }
                    }

                    <div class="weui-media-box_appmsg">
                        <div class="weui-media-box__hd proinfo-txt-l"><span class="promotion-label-tit">数量</span></div>
                        <div class="weui-media-box__bd">
                            <div class="promotion-sku clear">
                                <div class="Spinner"></div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="weui-msg__opr-area">
                    <p class="weui-btn-area" style="margin:0 0 0;float: left;
    width:49%;">
                        <a href="javascript:void(0);" style="width: 100%;background-color: #ffb03f;" id="btn_saveCart" class="weui-btn weui-btn_zhifu">加入购物车</a>
                    </p>
                    <p class="weui-btn-area" style="margin:0 0 0;float: right;
    width:49%;">
                        
                        <a href="javascript:void(0);" style="width: 100%;background-color:#188dee" id="btn_createOrder" class="weui-btn weui-btn_zhifu">立即购买</a>

                    </p>

                </div>
            </div>
        </div>
    </div>
</div>
<script src="~/scripts/js/swiper.js"></script>
<script src="~/scripts/js/jquery.Spinner.js?v=11"></script>

<script src="~/scripts/Product/ProductDetail.js?v=213"></script>
<script src="~/scripts/Common/ShopCartManager.js"></script>
<script>
    ProductDetailClass.Instance.Init();
</script>

